package com.ruoyi.common.core.domain;

import java.io.Serializable;
import java.util.List;
import java.util.Stack;
import java.util.stream.Collectors;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.ruoyi.common.core.domain.depot.Monetary;
import com.ruoyi.common.core.domain.depot.PreWarehouse;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.common.core.domain.walmart.State;

/**
 * Treeselect树结构实体类
 * 
 * @author ruoyi
 */
public class TreeSelect implements Serializable
{
    private static final long serialVersionUID = 1L;

    /** 节点ID */
    private Long id;

    /** 节点名称 */
    private String label;

    /** 子节点 */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<TreeSelect> children;

    private Long status;

    private String value;


    public TreeSelect(SysDept dept)
    {
        this.id = dept.getDeptId();
        this.label = dept.getDeptName();
        this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
    }
    public TreeSelect(SysMenu menu)
    {
        this.id = menu.getMenuId();
        this.label = menu.getMenuName();
        this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
    }

    public TreeSelect(ProductCates productCates) {
        this.id = productCates.getId();
        this.label = productCates.getName();
        this.children = productCates.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
    }

    public TreeSelect(Oem oem) {
        this.id = oem.getId();
        this.label = oem.getName();
        this.children = oem.getChildrenOem().stream().map(TreeSelect::new).collect(Collectors.toList());
    }

    public TreeSelect(Color color) {
        this.id = color.getId();
        this.label = color.getColorName();
        this.children = color.getChildrenColor().stream().map(TreeSelect::new).collect(Collectors.toList());
    }

    public TreeSelect(PaymentMethod payment){
        this.id = payment.getId();
        this.label = payment.getPaymentName();
        this.children = payment.getChildrenPaymen().stream().map(TreeSelect::new).collect(Collectors.toList());
    }

    public TreeSelect(ContractTemplates contractTemplates){
        this.id =contractTemplates.getId();
        this.label = contractTemplates.getName();
        this.children = contractTemplates.getChildrenTemplates().stream().map(TreeSelect::new).collect(Collectors.toList());
    }

    public TreeSelect(Quality quality){
        this.id =quality.getId();
        this.label = quality.getQualityName();
        this.children = quality.getChildrenQuality().stream().map(TreeSelect::new).collect(Collectors.toList());
    }

    public TreeSelect(Company company){
        this.id =company.getId();
        this.label = company.getCompanyName();
        this.children = company.getChildrenCompany().stream().map(TreeSelect::new).collect(Collectors.toList());
    }

    public TreeSelect(DeptQuality deptQuality){
        this.id =deptQuality.getId();
        this.label = deptQuality.getQualityName();
        this.children = deptQuality.getChildrenDeptQuality().stream().map(TreeSelect::new).collect(Collectors.toList());
    }

    public TreeSelect(ShipmentStatus shipmentStatus){
        this.id =shipmentStatus.getId();
        this.label = shipmentStatus.getNameStatus();
        this.status = shipmentStatus.getStatusId();
        this.children = shipmentStatus.getChildrenShipmentStatus().stream().map(TreeSelect::new).collect(Collectors.toList());
    }

    public TreeSelect(FreightMethod freightMethod){
        this.id =freightMethod.getId();
        this.label = freightMethod.getMannerName();
        this.children = freightMethod.getChildrenFreightMethod().stream().map(TreeSelect::new).collect(Collectors.toList());
    }

    public TreeSelect(Vendor vendor){
        this.id =vendor.getId();
        this.label = vendor.getName();
        this.children = vendor.getChildrenVendor().stream().map(TreeSelect::new).collect(Collectors.toList());
    }

    public TreeSelect(PreWarehouse preWarehouse){
        this.id =preWarehouse.getWarehouseId();
        this.label = preWarehouse.getWarehouseName();
        this.children = preWarehouse.getChildrenPreWarehouse().stream().map(TreeSelect::new).collect(Collectors.toList());
    }

    public TreeSelect(Monetary monetary){
        this.id =monetary.getMonetaryId();
        this.label = monetary.getMonetaryName();
        this.children = monetary.getChildrenMonetary().stream().map(TreeSelect::new).collect(Collectors.toList());
    }

    public TreeSelect(ProcuredOrders procuredOrders){
        this.id =procuredOrders.getOrdersId();
        this.label = procuredOrders.getOrdersNumber();
        this.children = procuredOrders.getChildrenProcuredOrders().stream().map(TreeSelect::new).collect(Collectors.toList());
    }

    public TreeSelect(Platform platform){
        this.id = platform.getShopId();
        this.label = platform.getShopName();
        this.children = platform.getChildrenPlatform().stream().map(TreeSelect::new).collect(Collectors.toList());
        this.value = platform.getAuthId();
    }

    public TreeSelect(SiteForm siteForm){
        this.id = siteForm.getSiteId();
        this.label = siteForm.getShopName();
        this.children = siteForm.getChildrenSiteForm().stream().map(TreeSelect::new).collect(Collectors.toList());
        this.value = siteForm.getSite();
    }

    public TreeSelect(State state){
        this.id = state.getStateId();
        this.label = state.getState();
        this.children = state.getChildrenStateForm().stream().map(TreeSelect::new).collect(Collectors.toList());
        this.value = state.getState();
    }
    public TreeSelect(Brand brand){
        this.id = brand.getId();
        this.label = brand.getBrandName();
        this.children = brand.getChildrenBrandForm().stream().map(TreeSelect::new).collect(Collectors.toList());
    }

    public TreeSelect(AuthBrand authBrand){
        this.id = authBrand.getAuthBrandId();
        this.label = authBrand.getBrandName();
        this.children = authBrand.getChildrenAuthBrandForm().stream().map(TreeSelect::new).collect(Collectors.toList());
        this.value = authBrand.getBrandName();
    }


    public Long getId()
    {
        return id;
    }

    public void setId(Long id)
    {
        this.id = id;
    }

    public String getLabel()
    {
        return label;
    }

    public void setLabel(String label)
    {
        this.label = label;
    }

    public List<TreeSelect> getChildren()
    {
        return children;
    }

    public void setChildren(List<TreeSelect> children)
    {
        this.children = children;
    }

    public Long getStatus() {
        return status;
    }

    public void setStatus(Long status) {
        this.status = status;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
